package com.macro.mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.macro.mall.dao.pms.PmsProductCategoryAttributeSetMappingMapper;
import com.macro.mall.dto.PmsProductCategoryAttributeSetMappingDto;
import com.macro.mall.model.pms.PmsProductCategoryAttributeSetMappingDO;
import com.macro.mall.dto.PmsProductCategoryAttrSetMappingQueryParam;
import com.macro.mall.common.util.BaseIdUtil;
import com.macro.mall.service.PmsProductCategoryAttributeSetMappingDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * (PmsProductCategoryAttrCategoryMapping)表服务实现类
 *
 * @author xchm
 * @since 2024-02-26 23:20:47
 */
@Service("pmsProductCategoryAttributeSetMappingDomainService")
public class PmsProductCategoryAttributeSetMappingDomainServiceImpl extends ServiceImpl<PmsProductCategoryAttributeSetMappingMapper, PmsProductCategoryAttributeSetMappingDO> implements PmsProductCategoryAttributeSetMappingDomainService {

    @Autowired
    private PmsProductCategoryAttributeSetMappingMapper pmsProductCategoryAttributeSetMappingMapper;


    /**
     * 分页列表
     *
     * @param param 查询请求入参
     * @return 属性模版分页对象
     */
    @Override
    public Page<PmsProductCategoryAttributeSetMappingDO> pageList(Page<PmsProductCategoryAttributeSetMappingDO> page, PmsProductCategoryAttrSetMappingQueryParam param) {
        List<PmsProductCategoryAttributeSetMappingDO>  list = pmsProductCategoryAttributeSetMappingMapper.pageList(page, param);
        page.setRecords(list);
        return page;
    }



     /**
     * 保存记录
     *
     * @param item 入参
     * @return void
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveItem(PmsProductCategoryAttributeSetMappingDO item){
        item.setId(BaseIdUtil.getId());
        pmsProductCategoryAttributeSetMappingMapper.insert(item);
    }



    /**
     * 更新记录
     *
     * @param item 入参
     * @return void
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateItem(PmsProductCategoryAttributeSetMappingDO item){
        pmsProductCategoryAttributeSetMappingMapper.updateById(item);
    }

    /**
     * 获取商品分类挂接的属性集合
     *
     * @param param 入参
     * @return List<PmsProductCategoryAttributeSetMappingDto>
     */
    @Override
    public List<PmsProductCategoryAttributeSetMappingDto> listMappingSet(PmsProductCategoryAttrSetMappingQueryParam param){
        return  pmsProductCategoryAttributeSetMappingMapper.listMappingSet(param);
    }
}

